const { http } = require("@/utils")
const { makeAutoObservable } = require("mobx")

class ChannelStore {
  // 定义数据
  channelsList = []
  // 响应式
  constructor() {
    makeAutoObservable(this)
  }
  // actions
  // 获取频道列表
  getChannels = async () => {
    const { data } = await http.get('/channels')
    // console.log(data.channels)
    // this.channelsList = data
    this.transformChannel(data.channels)
  }
  // 中转数据
  transformChannel = (data) => {
    // console.log(data)
    this.channelsList = data
    // console.log(this.channelsList)
  }
}
export default ChannelStore